﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;
public partial class log_FriendList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["searchstr"] != null)
        {
            Bind(Request["searchstr"].ToString());
        }
    }
    public void Bind(string str)
    {
        TSqlDB tdb = new TSqlDB();
        tdb.OpenRset("select iid as id,username as name from t_user1 where status='0'");
        DataTable dt=new DataTable();
        dt = tdb.DataSource.Table;
        tdb.Free();
        //dt.Columns.Add(new DataColumn("name"));
        //dt.Columns.Add(new DataColumn("id"));
        //DataRow dr=dt.NewRow();
        //dr["id"]="1";
        //dr["name"]="test1";
        //dt.Rows.Add(dr);
        //dr=dt.NewRow();
        //dr["id"]="2";
        //dr["name"]="test2";
        //dt.Rows.Add(dr);
        //dr=dt.NewRow();
        //dr["id"]="3";
        //dr["name"]="test3";
        //dt.Rows.Add(dr);
        //dr=dt.NewRow();
        //dr["id"]="4";
        //dr["name"]="test4";
        //dt.Rows.Add(dr);
        string exstr="";
        if (Request["exstr"] != null)
        {
            exstr = Request["exstr"].ToString();
            while (exstr.Trim().StartsWith(","))
            {
                exstr=exstr.Substring((exstr.Trim().IndexOf(",")+1));
                exstr=exstr.Replace(",", "','");
            }
        }
        DataView dv = dt.DefaultView;
        dv.RowFilter = "name like '%" + str + "%' ";
        if (exstr.Trim() != "")
        {
            dv.RowFilter += " and id not in ('" + exstr + "')";
        }
        rpList.DataSource = dv;
        rpList.DataBind();



    }
}
